#include <iostream>

using namespace std;

int main(int argc, char *args[])
{
	const int MAX = 1000;
	int matrix[MAX][MAX];
	int n;
	scanf("%d", &n);

	while (n != 0) {
		int i = 0, j = 0;
		for (; i < n; i++) {
			for (j = 0; j < n; j++) {
				scanf("%d", (*(matrix + i)) + j);
			}
		}
		bool isHomo = true;
		for (i = 0; i < n - 1; i++) {
			for (j = 0; j < n - 1; j++) {
				if ((matrix[i][j] + matrix[i + 1][j + 1]) != (matrix[i + 1][j] + matrix[i][j + 1])) {
					isHomo = false;
					break;
				}
			}
			if (!isHomo)
				break;
		}
		if (isHomo) {
			printf("homogeneous\n");
		} else {
			printf("not homogeneous\n");
		}
		scanf("%d", &n);
	}
	return 0;
}